<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<html:xhtml />
<script type="text/javascript">
    function togglePvalue() {
        if($("#chkPvalue").is(":checked"))
        {
            $("#selectPvalue").removeAttr("disabled");
            $("#textPvalue").removeAttr("disabled");
        }
        else
        {
            $("#selectPvalue").attr("disabled", "disabled");
            $("#textPvalue").attr("disabled", "disabled");
        }
    }
    function toggleSnp() {
        if($("#chkSnp").is(":checked"))
        {
            $("#textSnp").removeAttr("disabled");
        }
        else
        {
            $("#textSnp").attr("disabled", "disabled");
        }
    }
    function toggleGene() {
        if($("#chkGene").is(":checked"))
        {
            $("#textGene").removeAttr("disabled");
        }
        else
        {
            $("#textGene").attr("disabled", "disabled");
        }
    }
    function toggleChrom() {
        if($("#chkChrom").is(":checked"))
        {
            $("#textChrom").removeAttr("disabled");
        }
        else
        {
            $("#textChrom").attr("disabled", "disabled");
        }
    }
    function togglePathway() {
        if($("#chkPathway").is(":checked"))
        {
            $("#selectPathway").removeAttr("disabled");
        }
        else
        {
            $("#selectPathway").attr("disabled", "disabled");
        }
    }
    $(document).ready(function() {
        togglePvalue();
        toggleSnp();
        toggleGene();
        toggleChrom();
        togglePathway();
        $("#helpDialog").dialog({
            autoOpen: false,
            position: "right"
        });
        $("#helpButton").click(function() {
            $("#helpDialog").dialog("open");
        });
    });
</script>
<div id="assocSearch" class="content input">
    <h2>
        Association Results <span id="helpButton" class="ui-icon help ui-icon-info">&nbsp;&nbsp;&nbsp;</span>
    </h2>
    <html:form action="assocSearchSubmit">
        <dl>
            <dt><bean:message key="assocSearch.cohort" />:</dt>
            <dd>
                <html:select property="selectedCohorts" multiple="multiple" size="4">
                    <html:optionsCollection property="cohorts" label="name" value="name" />
                </html:select>
                <html:errors property="selectedCohorts" />
            </dd>
            <dt><bean:message key="assocSearch.pheno" />:</dt>
            <dd>
                <html:select property="selectedPhenotypes" multiple="multiple" size="4">
                    <html:optionsCollection property="phenotypes" label="name" value="name" />
                </html:select>
                <html:errors property="selectedPhenotypes" />
            </dd>
            <dt>
                <html:checkbox styleId="chkPvalue" property="chkPvalue" onclick="togglePvalue()" />
                <label for="chkPvalue"><bean:message key="assocSearch.pvalue" />:</label>
            </dt>
            <dd>
                <html:select styleId="selectPvalue" property="cutType">
                    <html:options property="availableCutType" />
                </html:select>
                <html:text styleId="textPvalue" property="cutValue" size="5" />
                <html:errors property="cutValue" />
            </dd>
            <dt>
                <html:checkbox styleId="chkSnp" property="chkSnp" onclick="toggleSnp()" />
                <label for="chkSnp"><bean:message key="assocSearch.snp" />:</label>
            </dt>
            <dd>
                <span class="title">Enter one RS Number or SNP alias on each line. Alias should be in the format -2454G/A or 3953C/T</span>
                <html:textarea styleId="textSnp" title="Enter one RS Number or SNP alias on each line. Alias should be in the format -2454G/A or 3953C/T" property="snps" rows="5" cols="20" />
                <html:errors property="snps" />
            </dd>
            <dt>
                <html:checkbox styleId="chkGene" property="chkGene" onclick="toggleGene()" />
                <label for="chkGene"><bean:message key="assocSearch.gene" />:</label>
            </dt>
            <dd>
                <span class="title">Enter one gene on each line.</span>
                <html:textarea styleId="textGene" title="Enter one gene on each line." property="genes" rows="5" cols="20"/>
                <html:errors property="genes" />
            </dd>
            <dt>
                <html:checkbox styleId="chkChrom" property="chkChromosome" onclick="toggleChrom()" />
                <label for="chkChrom"><bean:message key="assocSearch.chrom" />:</label>
            </dt>
            <dd>
                <span class="title">Enter one chromosome on each line.</span>
                <html:textarea styleId="textChrom" title="Enter one chromosome on each line." property="chromosomes" rows="5" cols="20" />
                <html:errors property="chromosomes" />
            </dd>
            <dt>
                <html:checkbox styleId="chkPathway" property="chkPathway" onclick="togglePathway()" />
                <label for="chkPathway"><bean:message key="assocSearch.pathway" />:</label>
            </dt>
            <dd>
                <span class="title">Enter one pathway on each line.</span>
                <html:textarea styleId="selectPathway" title="Enter one pathway on each line." property="pathways" rows="5" cols="20" />
                <html:errors property="pathways" />
            </dd>
            <dd class="button"><html:submit value="Search" property="submitType"/></dd>
        </dl>
    </html:form>
</div>
<div id="helpDialog" title="Association Results">
    <tiles:insert name="assocResultsHelp" />
</div>